package com.gujia.designpattern.factory;

import com.gujia.designpattern.factory.impl.HNFactory;
import com.gujia.designpattern.factory.impl.LeftHair;
import com.gujia.designpattern.factory.impl.RightHair;

public class FactoryTest {

    public static void main(String[] args) {
        HairInterface left = new LeftHair();

        left.draw();

        HairInterface right = new RightHair();

        right.draw();

        HairFactory factory = new HairFactory();

        left = factory.getHair("left");

        left.draw();


        right = factory.getHairByClass("com.gujia.designpattern.factory.impl.RightHair");

        right.draw();

        right = factory.getHairByClass(LeftHair.class);

        right.draw();


        PersonFactory personFactory = new HNFactory();

       Boy boy =  personFactory.getBoy();
       boy.drawMen();

    }
}
